package routers

import (
	"github.com/astaxie/beego"
	"lazyops_go/cmdbControllers"
)


func init() {

	//找到路由后执行controller 之前
	beego.InsertFilter("/cmdb/*", beego.BeforeExec, PermsFilter)

	//资产增删改查
	beego.Router("/cmdb/asset/", &cmdbControllers.AssetController{}, "get:IndexAsset")
	beego.Router("/cmdb/asset/:page/", &cmdbControllers.AssetController{}, "get:IndexAsset")
	beego.Router("/cmdb/addasset/",&cmdbControllers.AssetController{},"post:CreateAsset")
	beego.Router("/cmdb/idasset/",&cmdbControllers.AssetController{},"post:GetIdAsset")
	beego.Router("/cmdb/editasset/",&cmdbControllers.AssetController{},"put:EditAsset")
	beego.Router("/cmdb/delasset/",&cmdbControllers.AssetController{},"post:DelAsset")
	beego.Router("/cmdb/searchasset/:key/",&cmdbControllers.AssetController{},"get:SearchAsset")
	beego.Router("/cmdb/detailasset/",&cmdbControllers.AssetController{},"post:DetailAsset")
	beego.Router("/cmdb/connect/",&cmdbControllers.AssetController{},"post:SetBaseConfig")
	beego.Router("/cmdb/syncasset/",&cmdbControllers.AssetController{},"post:SyncAssetInfo")

	//IDC管理
	beego.Router("/cmdb/idc/", &cmdbControllers.IdcController{}, "get:IndexIdc")
	beego.Router("/cmdb/addidc/",&cmdbControllers.IdcController{},"post:CreateIdc")
	beego.Router("/cmdb/ididc/",&cmdbControllers.IdcController{},"post:GetIdIdc")
	beego.Router("/cmdb/editidc/",&cmdbControllers.IdcController{},"put:EditIdc")
	beego.Router("/cmdb/delidc/",&cmdbControllers.IdcController{},"post:DelIdc")
	beego.Router("/cmdb/searchidc/:key/",&cmdbControllers.IdcController{},"get:SearchIdc")

	//标签管理
	beego.Router("/cmdb/label/", &cmdbControllers.LabelController{}, "get:IndexLabel")
	beego.Router("/cmdb/addlabel/",&cmdbControllers.LabelController{},"post:CreateLabel")
	beego.Router("/cmdb/idlabel/",&cmdbControllers.LabelController{},"post:GetIdLabel")
	beego.Router("/cmdb/editlabel/",&cmdbControllers.LabelController{},"put:EditLabel")
	beego.Router("/cmdb/dellabel/",&cmdbControllers.LabelController{},"post:DelLabel")
	beego.Router("/cmdb/searchlabel/:key/",&cmdbControllers.LabelController{},"get:SearchLabel")

	//登陆用户
	beego.Router("/cmdb/lguser/", &cmdbControllers.LoginUserController{}, "get:IndexLgUser")
	beego.Router("/cmdb/addlguser/",&cmdbControllers.LoginUserController{},"post:CreateLgUser")
	beego.Router("/cmdb/idlguser/",&cmdbControllers.LoginUserController{},"post:GetIdLgUser")
	beego.Router("/cmdb/editlguser/",&cmdbControllers.LoginUserController{},"put:EditLgUser")
	beego.Router("/cmdb/dellguser/",&cmdbControllers.LoginUserController{},"post:DelLgUser")
	beego.Router("/cmdb/searchlguser/:key/",&cmdbControllers.LoginUserController{},"get:SearchLgUser")
}